const data = [
  {
    "name":"白羊座",
    "iconIndex":"https://www.d1xz.net/statics/d1xz/pc/public/images/big_xz_pic/2.png?v=3267986",
    "dataStart":[3, 21],
    "dataEnd":[4, 19],
    "date": "3.21-4.19"
  },
  {
    "name": "金牛座",
    "iconIndex": "https://www.d1xz.net/statics/d1xz/pc/public/images/big_xz_pic/3.png?v=62619c8",
    "dataStart": [4, 20],
    "dataEnd": [5, 20],
    "date": "4.20-5-20"
  },
  {
    "name": "双子座",
    "iconIndex": "https://www.d1xz.net/statics/d1xz/pc/public/images/big_xz_pic/4.png?v=c14aadb",
    "dataStart": [5, 21],
    "dataEnd": [6, 21],
    "date": "5.21-6.21"
  },
  {
    "name": "巨蟹座",
    "iconIndex": "https://www.d1xz.net/statics/d1xz/pc/public/images/big_xz_pic/5.png?v=ac534e4",
    "dataStart": [6, 22],
    "dataEnd": [7, 22],
    "date": "6.22-7.22"
  },
  {
    "name": "狮子座",
    "iconIndex": "https://www.d1xz.net/statics/d1xz/pc/public/images/big_xz_pic/6.png?v=2f37b9f",
    "dataStart": [7, 23],
    "dataEnd": [8, 22],
    "data": "7.23-8.22"
  },
  {
    "name": "处女座",
    "iconIndex": "https://www.d1xz.net/statics/d1xz/pc/public/images/big_xz_pic/7.png?v=55be20e",
    "dataStart": [8, 23],
    "dataEnd": [9, 22],
    "data": "8.23-9.22"
  },
  {
    "name": "天秤座",
    "iconIndex": "https://www.d1xz.net/statics/d1xz/pc/public/images/big_xz_pic/8.png?v=c087eca",
    "dataStart": [9, 23],
    "dataEnd": [10, 23],
    "date": "9.23-10.23"
  },
  {
    "name": "天蝎座",
    "iconIndex": "https://www.d1xz.net/statics/d1xz/pc/public/images/big_xz_pic/9.png?v=f87f76d",
    "dataStart": [10, 24],
    "dataEnd": [11, 22],
    "date": "10.24-11.22"
  },
  {
    "name": "射手座",
    "iconIndex": "https://www.d1xz.net/statics/d1xz/pc/public/images/big_xz_pic/10.png?v=6f3101f",
    "dataStart": [11, 23],
    "dataEnd": [12, 21],
    "date": "11.23-12.21"
  },
  {
    "name": "摩羯座",
    "iconIndex": "https://www.d1xz.net/statics/d1xz/pc/public/images/big_xz_pic/11.png?v=2f6d4a9",
    "dataStart": [12, 22],
    "dataEnd": [1, 19],
    "date": "12.22-1.19"
  },
  {
    "name": "水瓶座",
    "iconIndex": "https://www.d1xz.net/statics/d1xz/pc/public/images/big_xz_pic/12.png?v=b181d63",
    "dataStart": [1, 20],
    "dataEnd": [2, 18],
    "date": "1.20-2.18"
  },
  {
    "name": "双鱼座",
    "iconIndex": "https://www.d1xz.net/statics/d1xz/pc/public/images/big_xz_pic/13.png?v=96864f5",
    "dataStart": [2, 19],
    "dataEnd": [3, 20],
    "date": "2.19-3.20"
  }
]

/// 获取星座信息
function _acquireConstellationInfoFromDate(date) {
  let m = date.getMonth() + 1;
  let d = date.getDate();
  for (let i = 0; i < 12; i++) {
    let dic = data[i];
    let startArr = dic.dataStart;
    let endArr = dic.dataEnd;
    if (startArr[0] == m && startArr[1] <= d) {
      return dic;
    }
    if (endArr[0] == m && endArr[1] >= d) {
      return dic;
    }
  }
}

module.exports = {
  constellationInfo: _acquireConstellationInfoFromDate
}